/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package user;

/**
 *
 * @author AaronFrost
 */
public class StandardAccount extends BaseAccount{
    public StandardAccount()
    {
        super.setAccountIsNew(true);
    }
    public StandardAccount(String inAccountID)
    {
        getAccountInfo(inAccountID);
        getPasswordHistory(inAccountID);
    }

    public void Persist()
    {

    }
    public void Save()
    {
        if (super.getAccountIsNew())
        {
            //Insert new into database
        }
        else
        {
            //update password information into Database.
            if (super.getPasswordHasChanged())
            {
                super.InsertNewPasswordHistoryRecord();
            }
            if (super.getActiveHasChanged())
            {
                
            }
        }
    }

    private void getAccountInfo(String inAccountID) {
        throw new UnsupportedOperationException("Not yet implemented");
        //Select From the database the following information from the Accounts.DB where the AccountID = inAccountID
            /**
             * typeID
             * clientID
             * accountName
             * accountDescription
             * username
             * createdDT
             * lastModDT
             */

        //Select password from passwordhistory.db
        //where accountID = accountID
        //passwordhistoryid = (select max(passwordhistoryid) from passwordhistory.db where accountID = accountID limit 1)

    }

    private void getPasswordHistory(String inAccountID) {
        throw new UnsupportedOperationException("Not yet implemented");
        //Select from the passwordhistory.db the max(passwordid) where accountid = inAccountID;
            /**
             * passwordhistoryid
             * password
             * startDT
             * endDT
             *
             * order by passwordhistoryid desc
             */
        //Put the results of the last query into the passwordhistory array
    }
}
